package com.demo.spring;

import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

public class QueueMessageListener implements MessageListener{

	@Override
	public void onMessage(Message message) {
		try {
			if(message instanceof TextMessage){
				TextMessage tm = (TextMessage) message;
				System.out.println("监听消息："+tm.getText());
			}else{
				System.out.println("消息类型"+message.getClass());
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
